import time
def bubble (f):
    
    a=[]
    for i in f:
        a.append(int(i))
    st=time.time()
    for z in range(len(a)-2):
        for k in range (z+1,len(a)-1):                   
            if a[k]>a[k+1]:
                a[k],a[k+1]=a[k+1],a[k]                                 
                
    nd=time.time()    
    return nd-st
f1=open('m1_sorted.txt')
f2=open('m2_reverse.txt')
f3=open('m3_shuffle.txt')
print('m1_sorted.txt',int(bubble(f1)*1000),"millisecond")
print('m2_reverse.txt',int(bubble(f2)*1000),"millisecond")
print('m3_shuffle.txt',int(bubble(f3)*1000),"millisecond")
